<!-- 弹出页 -->
<form class="layui-form" id="fsysLog" >
	<!-- 隐藏属性 -->
	<input id="opttype"  type="hidden" name="opttype" value="${opttype}" />
	#if($sysLog.id) <input id="id"  type="hidden"    name="id" value="${sysLog.id}"  />  #end
	<input id="optuserid"  type="hidden" name="optuserid" #if($sysLog.optuserid) value="${sysLog.optuserid}" #end   />
	<!-- 内容 -->
	<div class="manage_text2">


		<div class="layui-form-item manage-form-item" >
			<label class="layui-form-label manage_text_bt"><span>类型：</span></label>
			<!-- 隐藏显示用 -->
			<input id="typetemp" class="layui-input newsName manage_text_input" style="display: none;" />

			<div class="layui-inline">
				<div class="layui-input-inline" id="typetempdiv">
					<select  lay-verify="required"  id="type" name="type" lay-search="" >
						<option value="0" #if($sysLog.type == 0 ) selected="selected" #end >增加数据</option>
						<option value="1" #if($sysLog.type == 1 ) selected="selected" #end >修改数据</option>
						<option value="2" #if($sysLog.type == 2 ) selected="selected" #end >删除数据</option>
						<option value="3" #if($sysLog.type == 3 ) selected="selected" #end >登录系统</option>
						<option value="5" #if($sysLog.type == 5 ) selected="selected" #end >查询数据</option>
						<option value="9" #if($sysLog.type == 9 ) selected="selected" #end >系统异常</option>
						<option value="4" #if($sysLog.type == 4 ) selected="selected" #end >其他</option>
					</select>
				</div>
			</div>

		</div>

		<div class="layui-form-item manage-form-item" >
			<label class="layui-form-label manage_text_bt"><span>操作模块：</span></label>
			<!--<input class="layui-input newsName manage_text_input" lay-verify="required" placeholder="" type="text" value="用户管理">-->
			<input class="layui-input newsName manage_text_input" lay-verify="required" id="modular" name="modular" #if($sysLog.modular) value="${sysLog.modular}" #end  />
		</div>


		<div class="layui-form-item manage-form-item">
			<label class="layui-form-label manage_text_bt"><span>内容：</span></label>
			<!--<input class="layui-input newsName manage_text_input" lay-verify="required" placeholder="" type="text" value="admin">-->
			<textarea class="layui-input newsName manage_text_input" lay-verify="required" style="height: 80px;" id="content" name="content">#if($sysLog.content) ${sysLog.content} #end</textarea>
		</div>


		<div class="layui-form-item manage-form-item"  flag="dis" >
			<label class="layui-form-label manage_text_bt"><span>创建人：</span></label>
			<input   flag="dis" class="layui-input newsName manage_text_input" lay-verify="required" id="optusername"    name="optusername" #if($sysLog.createtime) value="${sysLog.optusername}" #end  />
		</div>

		<div class="layui-form-item manage-form-item"  flag="dis" >
			<label class="layui-form-label manage_text_bt"><span>创建时间：</span></label>
			<input flag="dis" class="layui-input newsName manage_text_input" lay-verify="required" id="createtime"    name="createtime" #if($sysLog.createtime) value="${sysLog.createtime}" #end   />
		</div>

	</div>
</form>

<script type="text/javascript">


    function save(){
        var res = false;
        $.ajax({
            url:"${path}/log/save",
            type:"POST",
            cache:false,
            async:false,
            data:$("#fsysLog").serialize(),
            dataType:"json",
            success:function(data){
                if(data.success==true || data.success=='true' ){
                    parent.layer.msg('添加成功！', {icon: 1});
                    res = true;
				}else{
                    parent.layer.msg('添加失败！', {icon: 1});
				}

            },
            error:function(data){
                parent.layer.msg('系统异常！', {icon: 1});
            }
        });
        return res;
    }


    function update(){
        var res = false;
        $.ajax({
            url:"${path}/log/update",
            type:"POST",
            cache:false,
            async:false,
            data:$("#fsysLog").serialize(),
            dataType:"json",
            success:function(data){
                if(data.success==true || data.success=='true' ){
                    parent.layer.msg('修改成功！', {icon: 1});
                    res = true;
                }else{
                    parent.layer.msg('修改失败！', {icon: 5});
                }
            },
            error:function(data){
                parent.layer.msg('系统异常！', {icon: 5});
            }
        });
        return res;
    }


    (function() {
        var opttype = "${opttype}";
        if("detail"==opttype){//是查看
            $("form input,textarea,select").attr("readonly","readonly");
           	//这里面的select 要做特殊处理，没有办法
            $("#typetempdiv").hide();
            $("#typetemp").show();
            $("#typetemp").val($("#type option:selected").text());
        }else{
            $("input,textarea,select").removeAttr("readonly");
            if("add"==opttype){//添加，隐藏添加人和时间
               $("[flag=dis]").hide();
			}else{
                $("[flag=dis]").attr("readonly","readonly");
			}
        }

    })();
</script>